<!DOCTYPE html>
{% load static %}
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" type="image/png" href="{% static 'app01/img/logo.png' %}">
    <title>我的动态</title>
    <!-- Slick Slider -->
    <link rel="stylesheet" type="text/css" href="{% static 'app01/css/slick.min.css' %}"/>
    <link rel="stylesheet" type="text/css" href="{% static 'app01/css/slick-theme.min.css' %}"/>
    <!-- Feather Icon-->
    <link href="{% static 'app01/css/feather.css' %}" rel="stylesheet" type="text/css">
    <!-- Bootstrap core CSS -->
    <link href="{% static 'app01/css/bootstrap.min.css' %}" rel="stylesheet">
    <!-- Custom styles for this template -->
    <link href="{% static 'app01/css/style.css' %}" rel="stylesheet">

    <style>
        * {
            margin: 0px;
            padding: 0px;
        }

        ul {
            list-style: none;
        }

        #nav {
            height: 50px;
            background-color: #46474a;
        }

        #nav ul li {
            width: 120px;
            float: left;
        }

        #nav ul li a {
            display: block;
            width: 120px;
            height: 50px;
            line-height: 50px;
            text-decoration: none;
            font-size: 18px;
            /* font-weight: bold; */
            color: white;
            text-align: center;
        }

        #nav ul li a:hover {
            background-color: white;
            color: #46474a;
        }

        .dropdown {
            position: relative;
            display: inline-block;
        }

        .dropdown-content {
            display: none;
            position: absolute;
            background-color: #f9f9f9;
            min-width: 160px;
            box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
            padding: 12px 16px;
            z-index: 1;
        }

        .dropdown:hover .dropdown-content {
            display: block;
        }
    </style>
    <style type="text/css">
        li.margin {
            margin-left: 50px;
        }
    </style>
</head>
<body>
<!-- 导航栏 -->
<div id="nav" style="margin: -16px;">
    <ul>
        <li class="margin"><img src="{% static 'app01/img/logo.png' %}" style="width: 87.4px;height: 50px;">
        </li>
        <li><a href="{% url 'purchase_index' %}">购物商城</a></li>
        <li><a href="/moment/">车友圈</a></li>
        <li><a href="/view_power/">充电规划</a></li>
        <li><a href="/chatbot/botmain/">智能客服</a></li>
        <li><a href="/repair/">维修保养</a></li>

        {% if "info" in request.session.keys %}

        <li class="dropdown">
            <a href="#">
                我的</a>
            <div class="dropdown-content">
                <a href="{% url 'show_order' %}" style="color: #46474a;font-size: 17px;">购物订单</a>
                <a href="/repair/list/" style="color: #46474a;font-size: 17px;">维修订单</a>
                <a href="/infomation/" style="color: #46474a;font-size: 17px;">个人信息</a>
                <a href="/signout/" style="color: #46474a;font-size: 17px;">注销</a>
            </div>
        </li>

        {% else %}
        <li><a href="/signin/">登录 / 注册</a></li>
        {% endif %}

    </ul>
</div>
<!-- /.导航栏结束 -->

<div class="py-4">
    <div class="container">
        <div class="row">
            <!-- 左栏 -->
            <aside class="col col-xl-3 order-xl-1 col-lg-12 order-lg-1 col-12">
                <!-- 左一 -->
                <div class="box mb-3 shadow-sm border rounded bg-white profile-box text-center">
                    <div class="py-4 px-3 border-bottom">
                        <img src="{{ user.u_photo }}" class="img-fluid mt-2 rounded-circle" alt="Responsive image">
                        <h5 class="font-weight-bold text-dark mb-1 mt-4">{{ user.u_name }}</h5>
                        <p class="mb-0 text-muted">{{ user.u_cha }}</p>
                    </div>
                    <div class="d-flex">
                        <div class="col-6 border-right p-3">
                            <a href="/myfollow" class="font-weight-bold text-dark mb-1">{{ user.u_follow }}</a>
                            <p class="mb-0 text-black-50 small">关注</p>
                        </div>
                        <div class="col-6 p-3">
                            <a href="/myfans" class="font-weight-bold text-dark mb-1">{{ user.u_fans }}</a>
                            <p class="mb-0 text-black-50 small">粉丝</p>
                        </div>
                    </div>
                </div>
                <!-- 左二 -->
                <div class="box shadow-sm border rounded bg-white mb-3">
                    <div class="box-title border-bottom p-3">
                        <h6 class="m-0">我感兴趣的话题</h6>
                    </div>
                    <div class="box-body">
                        <div class="d-flex align-items-center osahan-post-header p-3 border-bottom people-list">
                            <div class="dropdown-list-image mr-3">
                                <img class="rounded-circle" src="{% static 'app01/img/baoyang.png' %}" alt="">
                            </div>
                            <div class="font-weight-bold">
                                <div class="text-truncate"># 汽车保养 <span class="badge badge-dark ml-1">1100</span></div>
                            </div>
                        </div>
                        <div class="d-flex align-items-center osahan-post-header p-3 border-bottom people-list">
                            <div class="dropdown-list-image mr-3">
                                <img class="rounded-circle" src="{% static 'app01/img/ly.jpg' %}" alt="">
                            </div>
                            <div class="font-weight-bold">
                                <div class="text-truncate"># 自驾游 <span class="badge badge-danger ml-1">670</span></div>
                            </div>
                        </div>
                        <div class="d-flex align-items-center osahan-post-header p-3 people-list">
                            <div class="dropdown-list-image mr-3">
                                <img class="rounded-circle" src="{% static 'app01/img/fc.jpg' %}" alt="">
                            </div>
                            <div class="font-weight-bold">
                                <div class="text-truncate"># 房车 <span class="badge badge-info ml-1">231</span></div>
                            </div>
                        </div>
                    </div>
                </div>
            </aside>
            <!-- 中间 -->
            <main class="col col-xl-6 order-xl-2 col-lg-12 order-lg-2 col-md-12 col-sm-12 col-12">
                <div class="box shadow-sm border rounded bg-white mb-3">
                    <div class="box-title border-bottom p-3">
                        <h6 class="m-0">我的动态</h6>
                    </div>
                    <!-- 所有帖子 -->
                    {% for t in topics %}
                    <div class="box shadow-sm border rounded bg-white mb-3 osahan-post">
                        <div class="p-3 d-flex align-items-center border-bottom osahan-post-header">
                            <div class="dropdown-list-image mr-3">
                                <a href="/detail/{{ t.id }}"><img class="rounded-circle" src="{{ t.t_uphoto }}" alt=""></a>
                                <div class="status-indicator bg-success"></div>
                            </div>
                            <div class="font-weight-bold">
                                <div class="text-truncate">{{ t.t_uname }}</div>
                                <div class="small text-gray-500">{{ t.t_ucha }}</div>
                            </div>
                            <span class="ml-auto small" style="white-space:pre">{{ t.create_time }}    </span>
                            <span>
                                <a href="" iddd="{{ t.id }}" onclick="deleter(this);"
                                   style="float: right;margin-right: 10px">  删除</a>
                            </span>
                        </div>
                        <div class="p-3 border-bottom osahan-post-body">
                            <p class="mb-0">{{ t.t_content }}<a href="#">#日常</a></p>
                        </div>
                        <div class="p-3 border-bottom osahan-post-footer">
                            <a href="#" class="mr-3 text-secondary"><i class="feather-heart text-danger"></i> {{ t.t_like }}</a>
                            <a href="#" class="mr-3 text-secondary"><i class="feather-message-square"></i> {{ t.t_comment }}</a>
                            <a href="#" class="mr-3 text-secondary"><i class="feather-share-2"></i> {{ t.t_share }}</a>
                        </div>
                    </div>
                    {% endfor %}
                </div>
            </main>

            <!-- 右栏 -->
            <aside class="col col-xl-3 order-xl-3 col-lg-12 order-lg-3 col-12">
                <div class="box shadow-sm border rounded bg-white mb-3">
                    <div class="box-title border-bottom p-3">
                        <h6 class="m-0">我的访客</h6>
                    </div>
                    <div class="box-body p-3">
                        <div class="d-flex align-items-center osahan-post-header mb-3 people-list">
                            <div class="dropdown-list-image mr-3">
                                <img class="rounded-circle" src="{% static 'app01/img/f1.jpg' %}" alt="">
                                <div class="status-indicator bg-success"></div>
                            </div>
                            <div class="font-weight-bold mr-2">
                                <div class="text-truncate">天天</div>
                                <div class="small text-gray-500">全职妈妈
                                </div>
                            </div>
                            <span class="ml-auto"><button type="button" class="btn btn-light btn-sm">回访</button>
                           </span>
                        </div>
                        <div class="d-flex align-items-center osahan-post-header mb-3 people-list">
                            <div class="dropdown-list-image mr-3">
                                <img class="rounded-circle" src="{% static 'app01/img/f2.jpg' %}" alt="">
                                <div class="status-indicator bg-success"></div>
                            </div>
                            <div class="font-weight-bold mr-2">
                                <div class="text-truncate">John Doe</div>
                                <div class="small text-gray-500">旅游家
                                </div>
                            </div>
                            <span class="ml-auto"><button type="button" class="btn btn-light btn-sm">回访</button>
                           </span>
                        </div>
                        <div class="d-flex align-items-center osahan-post-header mb-3 people-list">
                            <div class="dropdown-list-image mr-3">
                                <img class="rounded-circle" src="{% static 'app01/img/f3.jpg' %}" alt="">
                                <div class="status-indicator bg-success"></div>
                            </div>
                            <div class="font-weight-bold mr-2">
                                <div class="text-truncate">叁</div>
                                <div class="small text-gray-500">汽车设计师
                                </div>
                            </div>
                            <span class="ml-auto"><button type="button" class="btn btn-light btn-sm">回访</button>
                           </span>
                        </div>
                        <div class="d-flex align-items-center osahan-post-header mb-3 people-list">
                            <div class="dropdown-list-image mr-3">
                                <img class="rounded-circle" src="{% static 'app01/img/f4.jpg' %}" alt="">
                                <div class="status-indicator bg-success"></div>
                            </div>
                            <div class="font-weight-bold mr-2">
                                <div class="text-truncate">可爱的我</div>
                                <div class="small text-gray-500">无所事事的人
                                </div>
                            </div>
                            <span class="ml-auto"><button type="button" class="btn btn-light btn-sm">回访</button>
                           </span>
                        </div>
                        <div class="d-flex align-items-center osahan-post-header people-list">
                            <div class="dropdown-list-image mr-3">
                                <img class="rounded-circle" src="{% static 'app01/img/f5.jpg' %}" alt="">
                                <div class="status-indicator bg-success"></div>
                            </div>
                            <div class="font-weight-bold mr-2">
                                <div class="text-truncate">宁静致远</div>
                                <div class="small text-gray-500">爱车的人
                                </div>
                            </div>
                            <span class="ml-auto"><button type="button" class="btn btn-light btn-sm">回访</button>
                           </span>
                        </div>
                    </div>
                </div>
            </aside>
        </div>
    </div>
</div>
<!-- Bootstrap core JavaScript -->
<script src="{% static 'app01/js/jquery.min.js' %}"></script>
<script src="{% static 'app01/js/bootstrap.bundle.min.js' %}"></script>
<!-- slick Slider JS-->
<script type="text/javascript" src="{% static 'app01/js/slick.min.js' %}"></script>
<!-- Custom scripts for all pages-->
<script src="{% static 'app01/js/osahan.js' %}"></script>

<script>
    function deleter(ths) {
        var tid = $(ths).attr("iddd");
        $.ajax({
            url: window.location.href,
            type: "POST",
            data: {'type': 'delete', 't_id': tid},
            beforeSend: function (xhr, settings) {
                xhr.setRequestHeader("X-CSRFToken", "{{ csrf_token }}");    // csrf
            },
            success: function (data) {
                // data是服务器端返回的字符串
                var dic = JSON.parse(data)
                if (!dic.status) alert(JSON.parse(data).msg);
                else window.location.href = window.location.href;
            }
        });
    }
</script>
</body>
</html>